package projet;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;

import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

/**
 * Servlet implementation class ServletAuth
 */
@WebServlet("/ServletAuth")
public class ServletAuth extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ServletAuth() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Projet XML</title>");
        out.print("<link rel=\"stylesheet\" href=\"Style.css\" type=\"text/css\" media=\"screen\" />");
        out.print("<script src=\"js/jquery-1.3.1.min.js\" type=\"text/javascript\"></script>"); 
        out.print("<script src=\"js/slide.js\" type=\"text/javascript\"></script>");
        out.println("</head>");
        out.println("<body>");
        
        
        out.println("<div id=\"toppanel\">");
		out.println("<div id=\"panel\">");
		out.println("<div class=\"content clearfix\">");
		out.println("<div class=\"left\">");
		out.println("<form class=\"clearfix\" action=\"ExempleServlet\" method=\"post\">");
		out.println("<h1>Member Login</h1>");
		out.println("<label class=\"grey\" for=\"log\">Username:</label>");
		out.println("<input class=\"field inputbox\" type=\"text\" name=\"login\" id=\"inputbox\" class=\"inputbox\" value=\"\" size=\"23\" />");
		out.println("<label class=\"grey\" for=\"pwd\">Password:</label>");		
		out.println("<input class=\"field inputbox\" type=\"password\" name=\"password\" id=\"inputbox\" class=\"inputbox\" size=\"23\" />");		
		out.println("<label><input name=\"rememberme\" id=\"rememberme\" type=\"checkbox\" checked=\"checked\" value=\"forever\" /> &nbsp;Remember me</label>");		
		out.println("<div class=\"clear\"></div>");		
		out.println("<input type=\"submit\" name=\"submit\" value=\"Login\" class=\"bt_login\" />");		
		out.println("<a class=\"lost-pwd\" href=\"#\">Lost your password?</a>");		
		out.println("</form>");	
		out.println("</div>");				
		out.println("</div>");		
		out.println("</div>"); 
		out.println("<div class=\"tab\">");		
		out.println("<ul class=\"login\">");		
		out.println("<li class=\"left\">&nbsp;</li>");		
		out.println("<li>Click =></li>");		
		out.println("<li class=\"sep\">|</li>");		
		out.println("<li id=\"toggle\">");		
		out.println("<a id=\"open\" class=\"open\" href=\"#\">Log In</a>");		
		out.println("<a id=\"close\" style=\"display: none;\" class=\"close\" href=\"#\">Close Panel</a>");					
		out.println("</li>");		
		out.println("<li class=\"right\">&nbsp;</li>");		
		out.println("</ul>"); 		
		out.println("</div>");
		out.println("</div>");		    				  		    

		
        out.println("</body>");
        out.println("</html>");	
        //System.out.println("test  "+request.getParameter("login"));
      //  System.out.println(request.getSession().getAttribute("login"));
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
